//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package messages;

import common.ByteStream;
import common.LogicLong;
import common.LogicPickedPassenger;
import common.LogicXXEntry;
import common.MailEntry;
import common.RoadsideShop;
import common.SharedBoatCrate;
import common.Utils;
import common.decompressedData;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

public class OwnHomeData extends Base {
    public static final int MsgType = 24101;
    public String HomeData = new String();
    public String FarmName = null;
    public LogicLong NeighborhoodID = null;
    public String NeighborhoodName = null;
    private LinkedHashMap<Integer, Integer> inventory = new LinkedHashMap();
    private RoadsideShop shop = null;
    private List<Integer> intArray = null;
    private List<SharedBoatCrate> sbc = null;
    private List<LogicXXEntry> xxEntries = null;
    private List<LogicPickedPassenger> passengers = null;
    private List<MailEntry> mails = null;

    public OwnHomeData() {
        super(24101);
    }

    public void encode(ByteStream stream) {
    }

    public void decode(ByteStream stream) {
        this.isDecoded = false;
        stream.skip(16);
        int itemsLen = stream.readShort();

        int numslots;
        int mailEntruesCount;
        int intArrayCount;
        for(numslots = 0; numslots < itemsLen; ++numslots) {
            mailEntruesCount = stream.readInt();
            intArrayCount = stream.readInt();
            this.inventory.put(Integer.valueOf(mailEntruesCount), Integer.valueOf(intArrayCount));
        }

        stream.skip(274);
        numslots = stream.readInt();
        if(numslots >= 0) {
            this.shop = new RoadsideShop(numslots);
            this.shop.decode(stream);
        }

        this.FarmName = stream.readString();
        mailEntruesCount = stream.readInt();
        if(mailEntruesCount > 0) {
            this.mails = new ArrayList(mailEntruesCount);

            for(intArrayCount = 0; intArrayCount < mailEntruesCount; ++intArrayCount) {
                MailEntry sharedBoatCrateCount = new MailEntry();
                sharedBoatCrateCount.decode(stream);
                this.mails.add(sharedBoatCrateCount);
            }
        }

        intArrayCount = stream.readInt();
        int var11;
        if(intArrayCount > 0) {
            this.intArray = new ArrayList(intArrayCount);

            for(var11 = 0; var11 < intArrayCount; ++var11) {
                this.intArray.add(Integer.valueOf(stream.readInt()));
            }
        }

        var11 = stream.readInt();
        int xxEntryCount;
        if(var11 > 0) {
            this.sbc = new ArrayList(var11);

            for(xxEntryCount = 0; xxEntryCount < var11; ++xxEntryCount) {
                SharedBoatCrate passangersPickedCount = new SharedBoatCrate();
                passangersPickedCount.decode(stream);
                this.sbc.add(passangersPickedCount);
            }
        }

        xxEntryCount = stream.readInt();
        int var12;
        if(xxEntryCount > 0) {
            this.xxEntries = new ArrayList(xxEntryCount);

            for(var12 = 0; var12 < xxEntryCount; ++var12) {
                LogicXXEntry d = new LogicXXEntry();
                d.decode(stream);
                this.xxEntries.add(d);
            }
        }

        var12 = stream.readInt();
        if(var12 > 0) {
            this.passengers = new ArrayList(var12);

            for(int var13 = 0; var13 < var12; ++var13) {
                LogicPickedPassenger lpp = new LogicPickedPassenger();
                lpp.decode(stream);
                this.passengers.add(lpp);
            }
        }

        if(stream.readBoolean()) {
            this.NeighborhoodID = new LogicLong();
            this.NeighborhoodID.decode(stream);
            this.NeighborhoodName = stream.readString();
        }

        decompressedData var14 = Utils.tryToDecompressData(stream.getUnreadBytes());
        if(var14.resultString.length() > 0) {
            this.HomeData = var14.resultString;
            this.isDecoded = true;
        }

    }

    public LinkedHashMap<Integer, Integer> getInventory() {
        return this.inventory;
    }

    public RoadsideShop getShop() {
        return this.shop;
    }
}
